About Collection Objects
QuickDraw GX supports collection objects to store and to allow your application to store printing-related, formatting, and paper-type information associated with a printable document. Essentially, these collections specify additional information that are not absolutely required to print a job, format a document, or specify the kind of paper. In QuickDraw GX printing, collection objects typically store information you can use to customize dialog boxes. You can access information required by your application from these collection objects, however, whether or not you allow the user a choice in a dialog box. You can also use collection objects to store information that is of use only to your application.You can use collection objects without customizing dialog boxes. For example, a user may print by dragging the document's icon onto a desktop printer or by choosing the Print One Copy menu item from the File menu. In these cases, your application may need to change the settings in a collection object directly, without user intervention.
You can also store information that is not already provided by QuickDraw GX. For example, as part of using QuickDraw GX page formatting features, your application is responsible for managing the correspondence between format objects and individual pages in a document. Your application can use a format collection item to store this correspondence. Storing correspondence information in a format collection is discussed in "Associating Format Objects With Document Pages," which begins on page 3-61.
Collection Tag IDs and Item IDs
When you add data (referred to as a collection item) to a collection object, the Collection Manager associates the data with a collection tag ID and a collection item tag. Together, the 4-byte collection tag ID and the 4-byte collection item tag ID uniquely identify a collection item within a particular collection object.
QuickDraw GX assigns the gxPrintingTagID tag ID to each of its predefined collection items:
- Note
- To avoid the confusion between tag objects (which are not related to collection objects at all), collection tags, and collection item tags, this book refers to collection tags as tag IDs and to collection item tags as item IDs. Tags, when used in this book, refer to tag objects.
![]()
enum { gxPrintingTagID = -28672 };For each of its collection items, QuickDraw GX defines an item ID, such as gxCopiesTag for the collection item that defines the number of copies to print:
enum {gxCopiesTag = 'copy'};QuickDraw GX reserves all tag IDs that are negative or less than 127. It also reserves all collection items defined by lowercase characters. For example, you can use your application's registered creator type for the tag ID.In addition to the collection tag and collection item ID, the Collection Manager allows items to be accessed by index. You can use an index to provide faster access to specific items in a collection or to perform operations on all collection items in a collection object. This index does not uniquely identify an item, however, because adding or removing items can change an item's index number. For information about collection indexes and collection objects in general, see the Collection Manager chapter of Inside Macintosh: QuickDraw GX Environment and Utilities.
Item Structures
A structure defines the form of most collection items. A type definition is associated with each of these structures:
struct gxCopiesInfo{ long copies; }; typedef struct gxCopiesInfo gxCopiesInfo;For example, you can use gxCopiesInfo as both a structure name and a data type definition:
gxCopiesInfo myCopies; struct gxCopiesInfo myCopies;In this book, only the structure definition is presented. Type definitions are only presented when they are not associated with a structure, as in gxCollectionCategory, defined in the next section.Categories of Collection Items
If you add an item to a collection, you need to decide whether the contents will be valid if the output printer or formatting printer changes. You also must decide if the item should persist when the collection is flattened.QuickDraw GX purges the items that are not valid after the printer driver changes, based on the contents of the collection item's user attribute bits. It also decides which items to flatten based on these bits. For general information about user attribute bits, see the Collection Manager chapter of Inside Macintosh: QuickDraw GX Environment and Utilities.
A printer-driver switch occurs whenever a user changes the device class (type of printer) of the output printer or formatting printer associated with a particular document. For example, if the user switches output printers, QuickDraw GX discards the tray-feed information, which specifies the current paper tray, because it may have changed.
QuickDraw GX assigns collection object items into categories based on the contents of the gxCollectionCategory user attribute bits, as shown in the following enumeration:
typedef short gxCollectionCategory; enum { gxNoCollectionCategory = (gxCollectionCategory) 0x0000, gxOutputDriverCategory = (gxCollectionCategory) 0x0001, gxFormattingDriverCategory = (gxCollectionCategory) 0x0002, gxDriverVolatileCategory = (gxCollectionCategory) 0x0004, gxVolatileOutputDriverCategory = gxOutputDriverCategory + gxDriverVolatileCategory, gxVolatileFormattingDriverCategory = gxFormattingDriverCategory + gxDriverVolatileCategory };Items in the gxNoCollectionCategory category are not purged. Data that is specific to an output printer driver should be grouped in thegxVolatileOutputDriverCategory
collection item category. Data that is specific to a formatting printer driver should be grouped in the gxVolatileFormattingDriverCategory collection item category.Data that need not be saved when a job is flattened should be grouped in the gxDriverVolatileCategory collection item category. You must also clear the
collectionPersistenceBit
attribute bit if you would like to keep the information but do not require it to be saved with the collection.The Job Collection
QuickDraw GX primarily stores in a job collection the information contained in the Print dialog box and its General panel, Paper Match panel, and Print Time panel. Panels for the Print dialog box are discussed in the chapter "Introduction to Printing With QuickDraw GX" in this book. QuickDraw GX stores 18 items in a job collection, as shown in Figure 3-1.
A brief description of each collection item follows. To see how the pieces of data are structured in the collection item, see "Constants and Data Types for Job Collection Items" beginning on page 3-78. Job collection items include the following:
- Print-job information. This collection item describes the job information for the print job. It contains information such as the total number of pages to print, the print job's priority, designated time to print, and the amount of time in which to keep a print job in an alert state before cancelling the job. It also contains the first page from which to begin printing and indicates whether the user chose to be alerted before printing begins or after printing is finished. In addition, this property contains the name of the application used to create the printable document, the name of the user's document, and the name of the user associated with the printable document.
- Collation information. This collection item specifies whether document pages should be collated when printed. The user typically specifies whether collation is desired in the Collate Copies checkbox in the Print dialog box.
- Copies information. This collection item contains the number of copies of the document to print. The user specifies the number of copies to print in the Copies field in the Print dialog box.
- Page-range information. This collection item contains the page-range information in the job object as well as data that allows customized or replacement page ranges. It contains the user-specified custom, default, or replacement page-range information from the Print dialog box.
- Quality information. This collection item contains information about the quality mode, such as the default quality mode and the current mode. It also includes the number of quality menu items and an array of quality names (such as "Best") to display in the Quality pop-up menu in the Print dialog box.
- File-destination information. This collection item contains the file-destination information for the job object. It specifies whether the user chose File in the Destination pop-up menu in the Print dialog box.
- File-location information. This collection item contains the file-location information as a
FSSpec
structure. It typically contains the result of a call toStandardGetFile
, which is used to determine the filename when the user prints to a file.- File-format information. This collection item contains the name of the file format if the destination of the print job is a file.
- File-fonts information. This collection item specifies whether fonts should be stored as part of the file. If fonts are stored, it specifies whether all fonts are stored or only nonstandard fonts.
- Paper-feed information. This collection item contains the paper-feed information for the job object. It specifies whether the user chose the Automatic or Manual radio button for Paper Feed in the Print dialog box.
- Manual-feed information. This property contains the manual-feed information for the job object. It specifies the number of paper types to manually feed and an array of paper-type names to display.
- Standard mapping information. This collection item specifies whether to use standard mapping information for the print job. The item contains a Boolean value that is
true
if input tray paper matching is to be used.- Special mapping information. This collection item contains the special mapping information for the job object. It specifies mapping options, such as whether to redirect the pages in a document to a particular paper tray or whether to scale pages or tile pages in a document.
- Tray-mapping information. This collection specifies the tray-mapping information for the job object. It contains the index for a paper tray, which the user typically specifies by selecting a tray from the Paper Match panel of the Print dialog box.
- Print-panel information. This collection item contains the print-panel information for the job object. It specifies the name of the first panel to appear when your application displays the Print dialog box.
- Format-panel information. This collection item contains the format-panel information for the job object. It specifies the name of the first panel to appear when your application displays the Page Setup dialog box.
- Paper-mapping information. This collection item contains the paper-mapping information for the job object. If it is used, it contains a flattened paper-type resource.
- Translated-document information. This collection item contains the translated-document information for the job object. QuickDraw GX provides this information only for documents designed for printing with the Macintosh Printing Manager.
The Format Collection
QuickDraw GX primarily stores information from the Page Setup and Custom Page Setup dialog boxes in a format collection. You need to call theGXChangedFormat
function each time you change the format collection.QuickDraw GX stores nine items in a format collection, as shown in Figure 3-2.
Figure 3-2 The format collection
A brief description of each collection item follows. To see how the pieces of data are structured in the collection item, see "Constants and Data Types for Format Collection Items" beginning on page 3-89. Format collection items include the following:
- Orientation information. This collection item contains the orientation information for the format object. It specifies whether to print a document (or a specific page) in portrait, landscape, or rotated landscape orientation. A user typically specifies orientation for an entire document in the Page Setup dialog box and specifies orientation for an individual page in the Custom Page Setup dialog box.
- Scaling information. This collection item contains the scaling information for the format object. It specifies a document's horizontal and vertical scaling factors. It also stores the minimum and maximum scaling factors allowed. A user typically specifies scaling for an entire document in the Page Setup dialog box and specifies scaling for an individual page in the Custom Page Setup dialog box.
- Direct-mode information. This collection item contains the direct-mode information for the format object. It specifies whether the user chose the Direct checkbox in the Page Setup dialog box. (This checkbox appears only if the printer driver supports text job format mode printing.) The text job format mode is discussed in the chapter "Advanced Printing Features" in this book.
- Format-halftone information. This collection item contains the format-halftone information for the format object. It specifies the total number of halftone structures that can be used for a specific page and an array of halftone structures. You can use halftones to render continuous tone images on noncontinuous tone printers if the printer driver or a printing extension supports halftones. For an introduction to halftones, see the view-related objects chapter of Inside Macintosh: GX Objects. For more information about this collection item, see "Halftones and Format Collections" beginning on page 3-21.
- Page-inversion information. This collection item contains the page-inversion information for the format object. It specifies whether to invert a page before printing.
- Horizontal page-flip information. This collection item contains the horizontal page-flip information for the format object. It specifies whether to horizontally flip the page left to right before printing.
- Vertical page-flip information. This collection item contains the vertical page-flip information for the format object. It specifies whether to vertically flip the page top to bottom before printing.
- Precise-bitmap information. This collection item contains the precise-bitmap information for the format object. It specifies whether to scale a page by 96% on 300-dpi printers.
- Paper-type lock information. This collection item contains the paper-type object lock information for the format object. It indicates whether the format's paper-type object is locked.
- Note
- The page-inversion information, page-flip information (horizontal and vertical), and precise-bitmap information are used, by default, only by PostScript printer drivers.
![]()
The Paper-Type Collection
The paper-type collection contains additional information about the paper-type object. QuickDraw GX stores in a paper-type collection five collection items, as shown in
Figure 3-3.Figure 3-3 The paper-type collection
A brief description of each collection item follows. To see how the pieces of data are structured in the collection item, see "Constants and Data Types for Paper-Type Collection Items" beginning on page 3-94. Paper-type collection items include the following:
- Base information. This collection item contains the base paper type information for the paper-type object, which indicates the source from which the paper type was created. Base types include: unknown, US Letter, US Legal, A4, B5, and tabloid.
- Creator information. This collection item contains the creator information structure for the paper-type object. It specifies the creator type of a paper-type object; for example,
'sypt'
for a system paper-type object creator and'uspt'
for a user paper-type object creator.- Units information. This collection item contains the units information for the paper-type object. Units can be specified in picas, millimeters, and inches.
- Flags information. This collection item contains the flags information for the paper-type object. The flags are bits used to set or clear specific attributes of a paper-type object, such as whether the paper type is the default paper type for this format. For information about paper-type object flags, see "Flags Information" beginning on page 3-97.
- Comment information. This collection item contains the comment information for the paper-type object. It allows a comment to be associated with a paper-type object. You can specify application-specific information in this comment. For example, you may want to store a textual description of the paper-type and its purpose.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help